home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 2002 #11
/
Amiga Plus CD - 2002 - No. 11.iso
/
amigaoscd
/
amigapluscd
/
AP-Website
/
news
/
admin
/
phpmyadmin
/
ldi_check.php
< prev
next >
Wrap
PHP Script
|
2002-01-27
|
1KB
|
49 lines
<?php
/* $Id: ldi_check.php,v 1.5 2000/07/31 13:17:26 tobias Exp $ */
/* This file checks and builds the sql-string for
LOAD DATA INFILE 'file_name.txt' [REPLACE | IGNORE] INTO TABLE table_name
[FIELDS
[TERMINATED BY '\t']
[OPTIONALLY] ENCLOSED BY "]
[ESCAPED BY '\\' ]]
[LINES TERMINATED BY '\n']
[(column_name,...)]
*/
if (isset($btnLDI) && ($textfile != "none"))
{
if(!isset($replace))
$replace = "";
$query = "LOAD DATA LOCAL INFILE '$textfile' $replace INTO TABLE $into_table ";
if (isset($field_terminater))
{ $query = $query . "FIELDS TERMINATED BY '".stripslashes($field_terminater)."' ";
}
if (isset($enclose_option) && strlen($enclose_option)>0)
{ $query = $query . "OPTIONALLY ";
}
if (strlen($enclosed)>0)
{ $query = $query . "ENCLOSED BY '$enclosed' ";
}
if (strlen($escaped)>0)
{ $query = $query . "ESCAPED BY '".stripslashes($escaped)."' ";
}
if (strlen($line_terminator)>0)
{ $query = $query . "LINES TERMINATED BY '".stripslashes($line_terminator)."' ";
}
if (strlen($column_name)>0)
{ $query = $query . "($column_name)";
}
$sql_query = addslashes($query);
require("sql.php");
}
else
{ require("ldi_table.php");
}
?>